package com.zjw;

import com.zjw.service.ResultService;
import com.zjw.service.StudentService;
import com.zjw.service.impl.ResultServiceImpl;
import com.zjw.service.impl.StudentServiceImpl;
import com.zjw.vo.StudentResultVo;

import java.util.Scanner;

public class Test3 {
    /**
     * 查询指定学号学生的考试成绩(学生姓名、课程编号、成绩、考试时间)
     */
    public static void main(String[] args) {
        StudentService studentService = new StudentServiceImpl();
        ResultService resultService = new ResultServiceImpl();
        do {
            System.out.println("请输入学号：");
            int studentNo = new Scanner(System.in).nextInt();
            if (studentService.isExistStudentId(studentNo)){
                for (StudentResultVo studentResultVo : resultService.getResultByStudentNo(studentNo)) {
                    System.out.println("学生姓名：" + studentResultVo.getStudentName() + "，课程编号：" + studentResultVo.getSubjectNo()+"，成绩：" + studentResultVo.getStudentResult() + "，考试时间：" + studentResultVo.getExamDate());
                }
            }else{
                System.out.println("该学生不存在！");
            }
        }while (true);
    }
}
